package cj.web.admin.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.admin.domain.FeedbackReply;

/**
 * 
 * @author 
 *
 */
@DAO
public interface FeedbackReplyDAO{
	
	@SQL("SELECT * FROM FeedbackReply WHERE deleteFlag=1 AND feedbackId=:t.feedbackId #if(:t.contents!=''){AND contents like '%##(:t.contents)%' } ORDER BY stickAt DESC,updateAt DESC LIMIT :t.start,:t.length ")
    List<FeedbackReply> query(@SQLParam("t") FeedbackReply feedbackReply);
	
	@SQL("SELECT count(*) FROM FeedbackReply WHERE deleteFlag=1 AND feedbackId=:t.feedbackId #if(:t.contents!=''){AND contents like '%##(:t.contents)%' } ")
    int querySize(@SQLParam("t") FeedbackReply feedbackReply);
    
    @SQL("select * from FeedbackReply where id=:1")
    FeedbackReply queryById(int id);
    
    @SQL("UPDATE FeedbackReply SET deleteFlag=0 WHERE id=:1")
    void deleteById(int id);
    
    @SQL("UPDATE FeedbackReply SET stickAT=now(),updateAT=now() WHERE id=:1")
    void updateByStickTime(int id);
	
	@SQL("UPDATE FeedbackReply SET stickAT=null,updateAT=now() WHERE id=:1")
    void updateByStickTimeIsNull(int id);
}